package com.test.pattern.command;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: Waitor
 * @description: 服务员类
 * @author: Mr du
 * @create: 2024-03-06 22:29
 */
public class Waitor {

    private List<Command> commands = new ArrayList<>();

    public void setCommand(Command cmd){
        commands.add(cmd);
    }
    
    //发起命令的功能 喊一句下单,厨师开始做饭
    public void orderUp(){
        System.out.println("美女服务员说,大厨:新订单来了!");
        for (Command command : commands) {
            command.execute();
        }
    }
}
